﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DimensionAddIn.V2
{
    public class XDRow
    {
        public XDItem[] Items { get; set; }

        public string GetCodePath(int? depth = null)
        {
            StringBuilder builder = new StringBuilder();
            if (depth == null)
            {
                for (int index = 0; index < Items.Length; index++)
                {
                    builder.AppendFormat(@"\{0}", Items[index].Code);
                }
            }
            else
            {
                for (int index = 0; index <= depth.Value; index++)
                {
                    builder.AppendFormat(@"\{0}", Items[index].Code);
                }
            }
            return builder.ToString();
        }
    }
}
